


public class GameRunner {

	public static void main(String[] args) throws Exception {
		
		int[] score = new int[2];
		String[] players = new String[2];
		if (args.length > 0)
			players[0] = args[0];
		else
			players[0] = "group1x";
		if (args.length > 1)
			players[1] = args[1];
		else
			players[1] = "Group9RL";
		TermGame game = new TermGame("KalahPie",4, players[0], players[1]);

		for (int i = 0; i < 50; i++) {
			System.out.println(i);
			
			double start_time = System.currentTimeMillis()/1000.0;
			
			game.play();
			double elapsed_time = System.currentTimeMillis()/1000.0 - start_time;
			
			System.out.format("Game completed in %.4f seconds.%n", elapsed_time);
			
			if (game.gs.getScore(0) > game.gs.getScore(1)) {
				score[0]++;
				System.out.println("0 won " + score[0] + " games.");
			}
			else if (game.gs.getScore(1) > game.gs.getScore(0)) {
				score[1]++;
				System.out.println("1 won " + score[1] + " games.");
			}
			else {
				System.out.println("Tie");
			}
				
			game.player[1].postGameActions(game.gs);
			game.player[0].postGameActions(game.gs);


			
//			GameStats.printStats(game.gameStates,0);
//			GameStats.printStats(game.gameStates,1);
			//game.player[1].postGameActions(gs);
		}
		
		
		game.player[0].actionsBeforeDeletion();
		game.player[1].actionsBeforeDeletion();
		System.out.println("0: " + score[0] + " 1: " + score[1]);
		
	}
	
}
